<?php 
@header('Content-type: text/html;charset=UTF-8');
require_once('ly_check.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>站点管理</title>
<link rel="stylesheet" href="../images/css.css" type="text/css" />
</head>
<body>
<table width="100%" border="0" cellpadding="5" cellspacing="0" class="table">
  <tr>
    <td class="bg_tr">&nbsp;站点管理</td><td class="bg_tr" style="width:80%;text-align:right;">
          <?php
          if ($_SESSION ["flag"] == 2) {
              ?>
              <span>

<a href="add.php">添加</a>

</span>
          <?php } ?></td>
  </tr>
</table>
<?php
	$sql="select * from servicestation where userId=".$_SESSION["userId"]." order by id";
	$rs=mysql_query($sql);
	$recordcount=mysql_num_rows($rs);
	$pagecount=($recordcount-1)/$pagesize+1;
	$pagecount=(int)$pagecount;
	$pageno=$_GET["pageno"];
	if($pageno<1)
	{
		$pageno=1;
	}
	if($pageno>$pagecount)
	{
		$pageno=$pagecount;
	}
	$startno=($pageno-1)*$pagesize;
	$sql="select servicestation.Id,serviceStationId,serviceStationName,countyTypeName,servicestation.memo from servicestation,countytype where servicestation.countyTypeId=countytype.countyTypeId and  servicestation.userId=".$_SESSION["userId"]." order by servicestation.id  limit $startno,$pagesize";
	$rs=mysql_query($sql);
?>
<table width="100%" border="0" align="center" cellpadding="5" cellspacing="1" class="td_bgf">
<thead>
<tr>
<th>站点编号</th>
<th>站点名称</th>
<th>站点类型</th>
<th>站点说明</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<?php
	while ($rows=mysql_fetch_assoc($rs))
	{
	?>
	  <tr>
     <td class="td_bg" align="center"><?php echo $rows["serviceStationId"]?></td>
     <td class="td_bg" align="center"><?php echo $rows["serviceStationName"]?></td>
     <td class="td_bg" align="center"><?php echo $rows["countyTypeName"]?></td>
    <td class="td_bg" align="center"><?php echo $rows["memo"]?></td>
    <td class="td_bg" align="center"><a href="edit.php?id=<?php echo $rows["Id"]?>"><font color=black>修改</font></a>&nbsp;&nbsp;
    <a href="resetpassword.php?id=<?php echo $rows["Id"]?>" onClick="return confirm('确定要重置该用户的密码?');">><font color=black>重置密码</font></a>
    </td>
  </tr>
	<?php
	}
?>
</tbody><tfoot>
<tr>
<td colspan="6" align="center" class="bg_tr">
<?php
echo "共" . $recordcount . "条记录   ";
		for($i=1;$i<=$pagecount;$i++)
		{
		?>
		<a href="?pageno=<?php echo $i?>"><?php echo $i?></a>
		<?php
		}
	?>	
	<?php
		if($pageno==1)
		{
			if ($pageno==$pagecount){
		?>
		首页 | 上页 | 下页  | 末页
		<?php
			}
		else{ ?>
		首页 | 上页 | <a href="?pageno=<?php echo $pageno+1?>">下页</a> | <a href="?pageno=<?php echo $pagecount?>">末页</a>
	<?php 	}}
		else if($pageno==$pagecount)
		{
		?>
		<a href="?pageno=1">首页</a> | <a href="?pageno=<?php echo $pageno-1?>">上页</a> | 下页 | 末页
		<?php
		}
		else
		{
		?>
		<a href="?pageno=1">首页</a> | <a href="?pageno=<?php echo $pageno-1?>">上页</a> | <a href="?pageno=<?php echo $pageno+1?>">下页</a> | <a href="?pageno=<?php echo $pagecount?>">末页</a>
		<?php
		}
	?></td>
</tr></tfoot>
</table>
</body>
</html>
